<?php

namespace App\Providers;

use Illuminate\Support\ServiceProvider;

class SrcCryptProvider extends ServiceProvider
{
    /**
     * Register services.
     *
     * @return void
     */
    public function register()
    {
        $this->registerCommands();
    }

    public function registerServers(){
        $this->app->singleton(Zk::class, function ($app) {
            if (is_null(static::$server)) {
                $this->createZookeeperServer();
            }
            return static::$server;
        });

        $this->app->alias(Zk::class, 'zk');
    }

    /**
     * Bootstrap services.
     *
     * @return void
     */
    public function boot()
    {
        //
    }

    protected function registerCommands()
    {
        $this->commands([
            ZookeeperServerCommand::class,
        ]);
    }
}
